using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class DatHang : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (rdFood.Checked)
        {
            rdMenu.Checked = false;
            divFood.Visible = true;
            divMenu.Visible = false;
        }
        else
        {
            rdMenu.Checked = true;
            divMenu.Visible = true;
            divFood.Visible = false;
        }
        FastFoodBO foodBO = new FastFoodBO();
        lstFood.DataSource = foodBO.GetAllMon();
        lstFood.DataBind();

        ThucDon td = new ThucDon();
        lstMenu.DataSource = td.GetAllFood();
        lstMenu.DataBind();
    }

    protected void btnAdd_Click(object sender, EventArgs e)
    {
        OrderBO orderBO = new OrderBO();
        OrderEntity entity = new OrderEntity();
        if (lstFood.SelectedItem != null)
        {
            entity.FoodId = long.Parse(lstFood.SelectedItem.Value);
        }
        else
        {
            entity.FoodId = 0;
        }
        if (lstMenu.SelectedItem != null)
        {
            entity.MenuId = long.Parse(lstMenu.SelectedItem.Value);
        }
        else
        {
            entity.MenuId = 0;
        }

        entity.Name = "AAA";
        entity.Address = "fds";
        entity.CustomerId = 0;
        entity.DateSend = DateTime.Now.Date;
        entity.OrderDate = DateTime.Now.Date;
        entity.PayType = 1;
        entity.PromotionId = 0;
        entity.Quantity = 10;
        entity.TotalAmount = 1000;
        entity.Amount = 10;
        bool flag = orderBO.OrderInsert(entity);
        if (flag)
        {
            Page.RegisterStartupScript("", "alert('1');");
        }
        else { }

    }
    protected void rdFood_CheckedChanged(object sender, EventArgs e)
    {
        if (rdFood.Checked)
        {
            rdMenu.Checked = false;
            divFood.Visible = true;
            divMenu.Visible = false;
        }
        else
        {
            rdMenu.Checked = true;
            divMenu.Visible = true;
            divFood.Visible = false;
        }
    }
    protected void rdMenu_CheckedChanged(object sender, EventArgs e)
    {
        if (rdMenu.Checked)
        {
            rdFood.Checked = false;
            divMenu.Visible = true;
            divFood.Visible = false;
        }
        else
        {
            rdFood.Checked = true;
            divMenu.Visible = false;
            divFood.Visible = true;
        }
    }
    protected void rdMenu_PreRender(object sender, EventArgs e)
    {

    }
}
